﻿using MyTodo.Common.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyTodo.ViewModels
{
    public class IndexViewModel: BindableBase
    {
        public IndexViewModel() 
        {
            TaskBars = new ObservableCollection<TaskBar>();
            CreateTaskBars();
            createTestData();
        }

        private ObservableCollection<TaskBar> taskBars;
        public ObservableCollection<TaskBar> TaskBars
        {
            get { return taskBars; }
            set { taskBars = value; RaisePropertyChanged(); }
        }

        private ObservableCollection<ToDoDto> toDoDtos;
        public ObservableCollection<ToDoDto> ToDoDtos
        {
            get { return toDoDtos; }
            set { toDoDtos = value; RaisePropertyChanged(); }
        }

        private ObservableCollection<MemDto> memDtos;
        public ObservableCollection<MemDto> MemDtos
        {
            get { return memDtos; }
            set { memDtos = value; RaisePropertyChanged(); }
        }

        void CreateTaskBars()
        {
            TaskBars.Add(new TaskBar() { Icon = "FerrisWheel", Title = "所有的", Content = "333", Color = "#468570", Target = "" });
            TaskBars.Add(new TaskBar() { Icon = "FilterCheck", Title = "搞好的", Content = "444", Color = "#ad3f5c", Target = "" });
            TaskBars.Add(new TaskBar() { Icon = "FileQuestion", Title = "差多少", Content = "555", Color = "#4b5f62", Target = "" });
            TaskBars.Add(new TaskBar() { Icon = "FolderQuestion", Title = "别忘记", Content = "666", Color = "#b4b85e", Target = "" });
        }
        void createTestData()
        {
            ToDoDtos = new ObservableCollection<ToDoDto>();
            MemDtos = new ObservableCollection<MemDto>();
            for (int i = 0; i < 10; i++)
            {
                ToDoDtos.Add(new ToDoDto() { Title = "待办" + i, Content = "正在处理" });
                MemDtos.Add(new MemDto() { Title = "备忘" + i, Content = "密码" });
            }
        }
    }
}
